package com.atguigu.gulimall.auth.controller;

import com.atguigu.gulimall.auth.service.IOauthService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpSession;

/**
 * @author : wenchao.long
 * @date : Created in 2021/8/10 10:51 周二
 * @description : 处理社交登录请求
 */
@Controller
@AllArgsConstructor
public class Oauth2Controller {

    private final IOauthService oauthService;

    @GetMapping("/oauth2.0/weibo/success")
    public String weibo(@RequestParam String code, HttpSession session) {
        return oauthService.weibo(code, session);
    }

    @GetMapping("/oauth2.0/gitee/success")
    public String gitee(@RequestParam String code) {
        return oauthService.gitee(code);
    }
}
